﻿using System;

using NUnit.Framework;
using Spring.Testing.NUnit;

using VisualAgile.Model;
using VisualAgile.IDAL;

namespace VisualAgile.DAL.Tests
{
    [TestFixture]
    public class ReleaseDaoTest : AbstractTransactionalDbProviderSpringContextTests
    {
        protected override string[] ConfigLocations
        {
            get
            {
                return new String[] { "objects.xml" };
            }
        }

        protected IReleaseDao ReleaseDao
        {
            get
            {
                return applicationContext.GetObject("ReleaseDao") as IReleaseDao;
            }
        }

        [Test]
        public void SaveReleaseTest()
        {
            Release release = new Release();            
            
            release.CreateTime = DateTime.Now;
            release.Name = "New Release"; // hard coded default release text
            release.PeriodFrom = DateTime.Now;
            release.PeriodTo = DateTime.Now.AddDays(27);

            ReleaseDao.Save(release);
            transactionManager.Commit(transactionStatus);
        }       
    }
}
